package com.ce;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ce.server.CheckEntryApplication;
import com.ce.server.common.OssEntity;
import com.ce.server.mapper.StudentMapper;
import com.ce.server.pojo.Student;
import com.ce.server.service.IAliOssService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.List;

/**
 * @DATE: 2021/11/18 18:14
 * @Author: 小爽帅到拖网速
 */
@SpringBootTest(classes = CheckEntryApplication.class)
@RunWith(SpringRunner.class)
public class test {

  @Autowired
  private StudentMapper studentMapper;

  @Autowired
  private IAliOssService aliOssService;

  @Autowired
  private OssEntity ossEntity;

  @Test
  public void test(){
    System.out.println(new BCryptPasswordEncoder().encode("123456"));
  }

  @Test
  public void testGetStus(){
    Integer count = studentMapper.selectCount(null);
    Page<Student> studentPage = new Page<>(1, count);
    IPage<Student> studentsByPage = studentMapper.getStudentsByPage(studentPage, new Student());
    List<Student> records = studentsByPage.getRecords();
    records.forEach(System.out::println);
  }

  @Test
  public void testAlioss(){
    System.out.println("111");
    System.out.println(ossEntity.toString());
  }

  @Test
  public void testAliossCreateBucket(){
    aliOssService.createBucket();
  }
}
